/*
 * Copyright (c) 2023, 2023,yzc.cn All rights reserved.
 *
 */
package com.crmapi.service.impl;

import com.crmapi.mapper.DeptMapper;
import com.crmapi.mapper.UserMapper;
import com.crmapi.pojo.Dept;
import com.crmapi.service.DeptService;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>Project: CRMSystem - DeptServiceImpl</p>
 * <p>Powered by yzc On 2023-11-16 20:05:52</p>
 * <p>描述：<p>
 *
 * @author yzc [yzc0415@126.com]
 * @version 1.0
 * @since 17
 */
@Service
public class DeptServiceImpl implements DeptService {

    @Autowired
    DeptMapper deptMapper;

    //查询所有部门
    @Override
    public List<Dept> queryDept() {
        return deptMapper.queryDept();
    }

    //查询部门树
    @Override
    public List<Dept> queryTree() {
        return deptMapper.queryTree();    }

    //根据id来查询部门信息
    @Override
    public Dept queryById(String id) {
        return deptMapper.queryById(id);
    }

    //查询子部门
    @Override
    public List<Map> queryChild(String parentId) {
        return deptMapper.queryChild(parentId);
    }

    //查询一级部门
    @Override
    public List<Dept> queryOne() {
        return deptMapper.queryOne();
    }

    //添加部门
    @Override
    public int insert(Dept dept) {
        return deptMapper.insert(dept);
    }

    //更新部门
    @Override
    public int update(Dept dept) {
        return deptMapper.update(dept);
    }

    //根据id删除部门

    @Override
    public int del(String id) {
        return deptMapper.delById(id);
    }
}
